﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MockPrjTeam1.DAO;
using MockPrjTeam1.Entity;
using MockPrjTeam1.Biz;

namespace MockPrjTeam1.Biz
{
    public class SearchBiz
    {
        public List<Search> Load()
        {
            var dao = new SearchDAO();
            return dao.Load();
        }
        public List<Search> Search(string PostCode, string Street, string Town)
        {
            var Searchdao = new SearchDAO();
            return Searchdao.Search(PostCode, Street, Town);
        }
        public Search GetOne(int id)
        {
            var dao = new SearchDAO();
            return dao.GetOne(id);
        }
        public bool EditAddress(Search Entity)
        {
            var dao = new SearchDAO();
            var result = dao.EditAddress(Entity);
            if (result)
                return true;
            else return false;
        }
        public bool CreateAddress(Search Entity)
        {
            var dao = new SearchDAO();
            var result = dao.CreateAddress(Entity);
            if (result)
                return true;
            else return false;
        }
        public int GetIdAddress()
        {
            var dao = new SearchDAO();
            var result = dao.GetIdAddress();
            return (result + 1);
        }
        public Search GetFKAddress(String Town)
        {
            var dao = new SearchDAO();
            return dao.GetFKAddress(Town);
        }
        public List<Search> GetTown(String County)
        {
            var dao = new SearchDAO();
            return dao.GetTown(County);
        }
        public List<Search> GetCountry()
        {
            var dao = new SearchDAO();
            return dao.GetCountry();
            
        }
        public List<Search> GetCounty(String Country)
        {
            var dao = new SearchDAO();
            return dao.GetCounty(Country);
        }
        public bool ValidPostCode(int ID, String PostCode)
        {
            var dao = new SearchDAO();
            return dao.ValidPostCode(ID, PostCode);
        }
        public List<Search> GetAll()
        {
            var dao = new SearchDAO();
            return dao.GetAll();
        }
        public List<Search> SearchBusiness(string BusinessName, string SicCode)
        {
            var Searchdao = new SearchDAO();
            return Searchdao.SearchBusiness(BusinessName, SicCode);
        }
        public Search GetOneBusiness(int id)
        {
            var dao = new SearchDAO();
            return dao.GetOneBusiness(id);
        }
        public bool EditBusiness(Search Entity)
        {
            var dao = new SearchDAO();
            var result = dao.EditBusiness(Entity);
            if (result)
                return true;
            else return false;
        }
        public bool CreateBusiness(Search Entity)
        {
            var dao = new SearchDAO();
            var result = dao.CreateBusiness(Entity);
            if (result)
                return true;
            else return false;
        }
        public int GetIdBusiness()
        {
            var dao = new SearchDAO();
            var result = dao.GetIdBusiness();
            return (result + 1);
        }
        public bool ValidSicCode(int ID, string SicCode)
        {
            var dao = new SearchDAO();
            return dao.ValidPostCode(ID, SicCode);
        }
    }
}